<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title><%= title %></title>
    <% include ../partial/meta %>
    <link rel="stylesheet" href="/app/static/css/frozen.css">
    <link rel="stylesheet" href="/app/static/css/client.css">
    <link rel="stylesheet" href="/app/static/css/jq.css">
</head>
<body>
    <header class ="header">
        <ul class="ui-row">
            <li class="ui-col ui-col-50" style ="background: url('/app/static/img/bg_avatar.png')">
                <div class="ui-whitespace">
                    <img src="<%= team.team.leaderAvatar %>" alt="profile" class ="ui-avatar">
                    <h5><%= user.user.name %></h5>
                    <h6>正在合租 寻找室友</h6>
                    <h6 class ="ui-help"><a href="http://a.app.qq.com/o/simple.jsp?pkgname=com.fangmm.housemother" name ="down">帮Ta扩散</a></h6>
                </div>
            </li>
            <li class="ui-col ui-col-50">
                <p><strong><%= house.house.community %></strong> </p>
                <div class="ui-nowrap ui-whitespace ui-txt-muted" style ="font-size: 14px;padding-top:6px;padding-bottom:6px;">
                    <%= house.house.region %>|<%= house.house.roomNum %>室<%= house.house.hallNum %>厅<%= house.house.toiletNum %>卫|<%= house.house.area %>㎡
                </div>
                
                    <div class ="facility-filter center">
                        <%
                            var bed = house.house.facilities.filter(function(facility) {
                                return facility.name == '床'
                            });
                            var air = house.house.facilities.filter(function(facility) {
                                return facility.name == '空调'
                            });
                            var chest = house.house.facilities.filter(function(facility) {
                                return facility.name == '衣橱'
                            });
                            var hot = house.house.facilities.filter(function(facility) {
                                return facility.name == '热水器'
                            });
                            var wash = house.house.facilities.filter(function(facility) {
                                return facility.name == '洗衣机'
                            });
                            if (bed[0].count > 0) {
                        %>
                            <img src="/app/static/img/iconfont-bed.png" alt="bed">
                        <%
                            }
                            if (air[0].count > 0) {
                        %>
                            <img src="/app/static/img/iconfont-air.png" alt="air">
                        <%
                            }
                            if (chest[0].count > 0) {
                        %>
                            <img src="/app/static/img/iconfont-chest.png" alt="chest">
                        <%
                            }
                            if (hot[0].count > 0) {
                        %>
                            <img src="/app/static/img/iconfont-hot.png" alt="hot">
                        <%
                            }
                            if (wash[0].count > 0) {
                        %>
                           <img src="/app/static/img/iconfont-wash.png" alt="wash">
                        <%
                            }
                        %>
                    </div>
                <%
                    if (user.user.tags && user.user.tags.length > 0) {
                %>
                <div>
                    <%
                        for (var i = 0; i < user.user.tags.length; i++) {
                    %>
                    <span class ="tag-list"><%= user.user.tags[i] %></span>
                    <%
                        }
                    %>
                </div>
                <%
                    }
                %>
                <p class="txt-detail" name ="more">更多详情</p>
            </li>
        </ul>
    </header>
    <section class ="section">
        <div class ="ui-theme">
            <p><%= user.user.fullName %>Nick_lee的房源报价</p>
        </div>
        <div class ="ui-rooms">
        <div class="ui-row-flex ui-whitespace">
            <%
                var seats = team.team.seats
                for (var i = 0; i < seats.length; i++) {
            %>
            <div class="ui-col ui-col room-name"><%= seats[i].roomName %></div>
            <%
                } 
            %>
        </div>
        <div class="ui-row-flex ui-whitespace center">
            <%
                var seats = team.team.seats
                for (var i = 0; i < seats.length; i++) {
            %>
                <%
                    if (seats[i].userId && seats[i].leader) {
                %>
                <div class="ui-col ui-col position"><img src="<%= seats[i].userAvatar %>" alt="">
                <%
                    if (seats[i].userGender == 'm') {
                %>
                <i class="ui-icon-male icon" style ="bottom: -2px"></i>
                <%
                    } else {
                %>
                <i class="ui-icon-female icon" style ="bottom: -2px"></i>
                <%
                    } 
                %>
                </div>
                <%
                    } else if(seats[i].userId && !seats[i].leader){
                %>
                <div class="ui-col ui-col position"><img src="<%= seats[i].userAvatar %>" alt="">
                <i class="ui-icon-male icon"></i>
                </div>
                <%
                    } else {
                %>
                <div class="ui-col ui-col middle"><div class="ui-nowrap ui-whitespace">¥<%= seats[i].rent %> 元/月</div></div>
                <%
                    } 
                %>
            <%
                } 
            %>
        </div>
        <div class="ui-row-flex ui-whitespace center">
            <%
                var seats = team.team.seats
                for (var i = 0; i < seats.length; i++) {
            %>
                <%
                    if (seats[i].userId && seats[i].leader) {
                %>
                <div class="ui-col ui-col"><div class="ui-nowrap ui-whitespace"><%= seats[i].userName %></div></div>
                <%
                    } else if(seats[i].userId && !seats[i].leader){
                %>
                <div class="ui-col ui-col"><div class="ui-nowrap ui-whitespace"><%= seats[i].userName %></div></div>
                <%
                    } else {
                %>
                <div class="ui-col ui-col"></div>
                <%
                    } 
                %>
            <%
                } 
            %>
        </div>
        <div class="ui-row-flex ui-whitespace center">
            <%
                var seats = team.team.seats
                for (var i = 0; i < seats.length; i++) {
            %>
                <%
                    if (seats[i].userId && seats[i].leader) {
                %>
                <div class="ui-col ui-col"><span class ="chief">室长</span></div>
                <%
                    } else if(seats[i].userId && !seats[i].leader){
                %>
                <div class="ui-col ui-col"><span class ="roommate">室友</span></div>
                <%
                    } else {
                %>
                <div class="ui-col ui-col"><span class ="join-in" name ="more">加入</span></div>
                <%
                    } 
                %>
            <%
                } 
            %>
        </div>
        </div>
        <div class ="ui-desc">
            <p class="ui-txt-muted">不满意报价？打开房妈妈APP<br>成为室长，自由选房，自由报价</p>
            <p class ="join">
                <a href="" name ="more">立即加入</a>
            </p>
        </div>
    </section>
    <section class ="section brand">
        <ul class="ui-row">
            <li class="ui-col ui-col-50">
                <h3><strong>关于房妈妈</strong></h3>
                <div class="line-clamp">
                    <p>房妈妈是专注年轻用户的租住生活服务商；房妈妈合租，是一款真正从合租用户需求出发设计的移动应用，我们将尽全力为用户提供安全有保障的合租平台：真实的房源、经过认证的趣味相投室友、好玩有趣的合租文化，我们希望给年轻人在异乡创造一个家的归属感。
                    </p>
                </div>
                <p class="txt-detail txt-more" name ="more">更多详情</p>
            </li>
            <li class="ui-col ui-col-50 brand-desc" style ="background: url('/app/static/img/bg_right.png')">
                <div class="ui-whitespace">
                    <img src="/app/static/img/logo.png" alt="profile" class ="ui-avatar">
                    <p>
                        <strong>房妈妈</strong>
                        <br>
                        <small>住一块，更有趣！</small>
                    </p>
                    <h6 class ="ui-help"><a href="http://a.app.qq.com/o/simple.jsp?pkgname=com.fangmm.housemother" name ="down">下载App</a></h6>
                </div>
            </li>
        </ul>
    </section>
    <section class ="section section-last">
        <div class ="ui-theme">
            <p><strong>组团拼租</strong>玩法</p>
        </div>
        <div class ="brand">
            <p>
                在房妈妈合租平台中，每个用户都可以成为室长或室友的角色，由室长主导选择房源并对房源不同房间报价，室友从每一套房源中的不同室长中选择其一申请加入，室长一一通过满员以后，各成员托管完成团保障金即可预约房东看房，看房满意，室长主导签约入住，便可以开始愉快的合租生活啦！
            </p>
        </div>
        <div class ="ui-desc-contain">
            <div class ="ui-desc">
                <p class="ui-txt-muted">让我们一起合租吧</p>
                <p class ="join">
                    <span name ="more">立即加入</span>
                </p>
            </div>
        </div>
    </section>
    <footer class ="footer">
        <div class="ui-down">
            <ul class="ui-row">
                <li class="ui-col ui-col-20">
                    <img src="/app/static/img/logo.png" alt="">
                </li>
                <li class="ui-col ui-col-50">
                    <div class="ui-fangmm">
                        <p>房妈妈合租</p>
                        <p>住一块，更有趣！</p>
                    </div>
                </li>
                <li class="ui-col ui-col-30">
                    <a href="http://a.app.qq.com/o/simple.jsp?pkgname=com.fangmm.housemother" class ="ui-share-down" name ="down">下载房妈妈</a>
                </li>
            </ul>
        </div>
    </footer>
        <script type="text/javascript" src ="/app/static/js/zepto.min.js"></script>
        <script src ="/app/static/js/customalert.js"></script>
        <script>
        $(function() {
            function alert(str) {
                $.customalert({
                    content: str
                })
            }
            $("[name='more']").on('click', function(event) {
                alert('<a href="http://a.app.qq.com/o/simple.jsp?pkgname=com.fangmm.housemother">点击下载房妈妈App，加入合租生活</a>')
            });


            // var utils = (function() {
            //     var ua = window.navigator.userAgent;
            //     return {
            //         notice: function(msg) {
            //             alert(msg)
            //         },
            //         isWeiXin: function() {
            //             return ua.toLowerCase().match(/MicroMessenger/i) == 'micromessenger';
            //         },
            //         isIphone: function() {
            //             return !!ua.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
            //         }
            //     }
            // })();
            // var down = $("[name='down']")
            // if(utils.isIphone()) {
            //     down.attr('href', '');
            // }

            // down.on('click', function(event) {
            //     if(utils.isWeiXin()) {
            //         event.preventDefault();
            //         utils.notice('右上角在浏览器中打开，即可下载房妈妈App');
            //         return false;
            //     }
            //     return true;
            // });
        })
        </script>
        <% include ../partial/analyse %>
</body>

</html>
